ActiveReports Developer 7
Export a Page Report (Rendering Extension)
Support Forum
ActiveReports Developer 7 > ActiveReports Developer Guide > How To > Page Report How To > Export a Page Report (Rendering Extension)

Glossary Item Box

You can use the rendering extensions for Image, HTML, PDF, XML or Word to render a page report in any of the supported formats. See Rendering for details on rendering formats.

The following steps provide an example of rendering a report in the format.

  1. In Visual Studio, create a new Windows Forms Application or open an existing one.
  2. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
  3. Add the following code inside the Form_Load event.

ShowTo write the code in Visual Basic.NET

Visual Basic.NET code. Paste INSIDE the Form Load event. Copy Code
' Provide the page report you want to render.                            
Dim _reportDef As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo("C:\MovieRatings.rdlx"))
Dim _reportRuntime As New GrapeCity.ActiveReports.Document.PageDocument(_reportDef)

' Set the file format you want the report to be rendered in. 
Dim exportFile As String = System.IO.Path.GetTempFileName() + ".pdf"
Dim myFile As New System.IO.FileInfo(exportFile)

' Provide settings for your rendering output. 
Dim settings As New GrapeCity.ActiveReports.Export.Pdf.Page.Settings()
settings.HideToolbar = True
settings.HideMenubar = True
settings.HideWindowUI = True

' Set the rendering extension and render the report. 
Dim _renderingExtension As New GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension()
Dim _provider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(myFile.Directory, System.IO.Path.GetFileNameWithoutExtension(myFile.Name))
_reportRuntime.Render(_renderingExtension, _provider, settings)
System.Diagnostics.Process.Start(exportFile)

ShowTo write the code in C#

C# code. Paste INSIDE the Form Load event. Copy Code
// Provide the page report you want to render.   
GrapeCity.ActiveReports.PageReport _reportDef = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(@"C:\MovieRatings.rdlx"));
GrapeCity.ActiveReports.Document.PageDocument _reportRuntime = new GrapeCity.ActiveReports.Document.PageDocument(_reportDef);

// Set the file format you want the report to be rendered in. 
string exportFile = System.IO.Path.GetTempFileName() + ".pdf";
System.IO.FileInfo myFile = new System.IO.FileInfo(exportFile);

// Provide settings for your rendering output. 
GrapeCity.ActiveReports.Export.Pdf.Page.Settings settings = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
settings.HideToolbar = true;
settings.HideMenubar = true;
settings.HideWindowUI = true;

// Set the rendering extension and render the report.
GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension _renderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider _provider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(myFile.Directory, System.IO.Path.GetFileNameWithoutExtension(myFile.Name));
_reportRuntime.Render(_renderingExtension, _provider, settings);
System.Diagnostics.Process.Start(exportFile);                       
Note: The code above works for any supported rendering format. Simply, replace the instances of PDF with the specific rendering format type and use the desired rendering extension.
©2014. ComponentOne, a division of GrapeCity. All rights reserved.